package fileIO;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

public class FileReadWriter {
	public static void main(String[] args) throws IOException {
//		test();
		test1();
	}

	private static void test1() throws UnsupportedEncodingException,
			IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new FileInputStream("/home/tarena/Desktop/1.txt"), "utf-8"));
		String s;
		while((s=in.readLine())!=null){
			System.out.println(s);
		}
		in.close();
	}

	private static void test() throws IOException {
		FileReader fin = new FileReader("/home/tarena/Desktop/2.txt");
		BufferedReader in = new BufferedReader(fin);
		int c;
		while ((c = in.read()) != -1) {
			System.out.println((char) c);
		}
		in.close();
	}
}
